{% extends "base.html" %}
{% load gross from prices_i18n %}
{% load i18n %}

{% block title %}{% trans "Order complete!" %} — {{ block.super }}{% endblock %}


{% block content %}
<h2>{% trans "Your order is now complete" %}</h2>
<p>{% trans "Thank you for your purchase!" %}</p>

<p>{% trans "Your order number is" %}: <a href="{% url 'order:details' token=order.token %}">{{ order }}</a></p>
{% endblock content %}

{% block google-analytics-script %}
    {{ block.super }}
    __ga('require', 'ecommerce', 'ecommerce.js');
    __ga('set', 'currencyCode', '{{ DEFAULT_CURRENCY }}');
    __ga('ecommerce:addTransaction', {
      'id': '{{ order.id }}',
      'affiliation': 'Saleor',
      'revenue': '{{ order.get_total.gross }}',
      'shipping': '{{ order.get_delivery_total.gross }}',
      'tax': '{{ order.get_total.tax }}'
    });
    {% for item in order.get_items %}
     __ga('ecommerce:addItem', {
        'id': '{{ item.id }}',
        'name': '{{ item }}',
        'sku': '{{ item.sku }}',
        'category': '{{ item.product.category }}',
        'price': '{{ item.unit_price_gross }}',
        'quantity': '{{ item.quantity }}'
      });
    {% endfor %}
    __ga('ecommerce:send');
{% endblock google-analytics-script %}
